<template>
  <el-dialog :title="upload.title" :visible.sync="upload.open" width="800px" append-to-body>
    <div style="display: flex;justify-content: space-between;">
      <span>当前状态: 发起会议</span>
      <span>业务单编号: {{ upload.row.id }}</span>
    </div>
    <el-descriptions :column="2" border>
      <el-descriptions-item>
        <template slot="label">
          承办人
        </template>
        {{ form.flCreator }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          承办部门
        </template>
        {{ form.flCreateDept }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          申请日期
        </template>
        {{ form.flCreateDate }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          联系电话
        </template>
        <el-input v-model="form.flCreatorPhone" placeholder="请输入联系电话"></el-input>
      </el-descriptions-item>
      <el-descriptions-item :span="2">
        <template slot="label">
          会议标题
        </template>
        <el-input v-model="form.flSubject" placeholder="请输入会议标题"></el-input>
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          会议开始时间
        </template>
        <el-date-picker v-model="form.startTime" type="datetime" placeholder="选择日期时间" :picker-options="pickerOptions"
          format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm" />
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          会议结束时间
        </template>
        <el-date-picker v-model="form.endTime" type="datetime" placeholder="选择日期时间" :picker-options="pickerOptions"
          format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm" />
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          会议室
        </template>
        {{ upload.row.meetName }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label">
          参会人数
        </template>
        <el-input v-model="form.meetingNum" placeholder="请输入参会人数"></el-input>
      </el-descriptions-item>
      <el-descriptions-item>
        <template slot="label" :span="2">
          备注
        </template>
        <el-input v-model="form.remark" placeholder="请输入备注"></el-input>
      </el-descriptions-item>
    </el-descriptions>
    <div slot="footer" class="dialog-footer">
      <!-- <el-button type="primary" @click="submit(0)">保存</el-button> -->
      <el-button type="primary" @click="submit(1)">提交</el-button>
      <el-button type="primary" plain @click="upload.open = false">关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { getInfo } from '@/api/login'
import { hyapSave } from '../../../api/xzgl/hyyd';
export default {
  props: {
    upload: {
      type: Object,
      // 导入参数
      default: {
        // 是否显示弹出层
        open: false,
        // 弹出层标题
        title: "详情",
        // 详情信息
        row: {}
      }
    },
  },
  data() {
    return {
      form: {},
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() < Date.now() - 86400 * 1000;//禁止选择今天以前的时间
        }
      }
    };
  },
  created() {
    this.init()
  },
  methods: {
    init() {
      getInfo().then(res => {
        console.log('user', res)
        console.log('upload', this.upload)
        const user = res.user
        this.form = {
          flCreator: user.nickName,
          flCreatorId: user.userId,
          flCreateDept: user.deptName,
          flCreateDeptId: user.deptId,
          flCreatorPhone: user.phonenumber,
          flCreateDate: this.parseTime(new Date()),
          meetPlace: this.upload.row.meetName,
          meetingId: this.upload.row.id,
        }
      })
    },
    submit(status) {
      this.form.status = status
      hyapSave(this.form).then(res => {
        this.$message.success('提交成功')
        this.upload.open = false
        this.$emit('closeDialog')
      })
    },
    closeDialog() {
      this.upload.open = false
      this.$emit('closeDialog')
    }
  }
}
</script>